package com.xiyoukt.springboot;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;

@Component
@ConfigurationProperties(prefix = "person")
//@Validated
public class Person {

    @NotBlank(message = "what's your name")
    private String name;

    @Max(value = 10, message = "you are old")
    @Min(value = 1, message = "are you kidd me")
    private Integer age;

    private Float mathGrade;

    private List<Integer> list;

    private Map<String, String> map;

    private Integer random;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Float getMathGrade() {
        return mathGrade;
    }

    public void setMathGrade(Float mathGrade) {
        this.mathGrade = mathGrade;
    }

    public List<Integer> getList() {
        return list;
    }

    public void setList(List<Integer> list) {
        this.list = list;
    }

    public Map<String, String> getMap() {
        return map;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    public Integer getRandom() {
        return random;
    }

    public void setRandom(Integer random) {
        this.random = random;
    }
}
